﻿// SysRenderDatagram.cpp : 定義 DLL 應用程式的匯出函式。
//

#include <CENTRALIZEDMGR.HPP>
#include <string.h>
#include <Sys\RenderUnit\SYSDDCLASSID.HPP>

using namespace CxxlMan;

cxxlObject *cxxlFASTCALL New_CTestRD();
cxxlPreserve2 *cxxlFASTCALL Regenera_CTestRD(const wchar_t *ClassID);

cxxlObject *cxxlFASTCALL New_CVertexRD_NC();
cxxlPreserve2 *cxxlFASTCALL Regenera_CVertexRD_NC(const wchar_t *ClassID);

cxxlObject *cxxlFASTCALL New_CVertexRD_NT();
cxxlPreserve2 *cxxlFASTCALL Regenera_CVertexRD_NT(const wchar_t *ClassID);

cxxlObject *cxxlFASTCALL New_CVertexRD_T();
cxxlPreserve2 *cxxlFASTCALL Regenera_CVertexRD_T(const wchar_t *ClassID);

cxxlObject *cxxlFASTCALL New_CVertexRD_C();
cxxlPreserve2 *cxxlFASTCALL Regenera_CVertexRD_C(const wchar_t *ClassID);

cxxlObject *cxxlFASTCALL New_CVertexRD_N();
cxxlPreserve2 *cxxlFASTCALL Regenera_CVertexRD_N(const wchar_t *ClassID);

cxxlObject *cxxlFASTCALL New_CTrianglesStripRD();
cxxlPreserve2 *cxxlFASTCALL Regenera_CTrianglesStripRD(const wchar_t *ClassID);

cxxlObject *cxxlFASTCALL New_CTrianglesListRD();
cxxlPreserve2 *cxxlFASTCALL Regenera_CTrianglesListRD(const wchar_t *ClassID);

cxxlObject *cxxlFASTCALL New_CLightAttribRD();
cxxlPreserve2 *cxxlFASTCALL Regenera_CLightAttribRD(const wchar_t *ClassID);

cxxlObject *cxxlFASTCALL New_CControlAttribRD();
cxxlPreserve2 *cxxlFASTCALL Regenera_CControlAttribRD(const wchar_t *ClassID);

cxxlObject *cxxlFASTCALL New_CGroupRD(void *Arg);
cxxlPreserve2 *cxxlFASTCALL Regenera_CGroupRD(const wchar_t *ClassID);

cxxlObject *cxxlFASTCALL New_CAnchorRD();
cxxlPreserve2 *cxxlFASTCALL Regenera_CAnchorRD(const wchar_t *ClassID);

cxxlObject *cxxlFASTCALL New_CLightAmbient();
cxxlPreserve2 *cxxlFASTCALL Regenera_CLightAmbient(const wchar_t *ClassID);
cxxlObject *cxxlFASTCALL New_CLightDirectional();
cxxlPreserve2 *cxxlFASTCALL Regenera_CLightDirectional(const wchar_t *ClassID);
cxxlObject *cxxlFASTCALL New_CLightPoint();
cxxlPreserve2 *cxxlFASTCALL Regenera_CLightPoint(const wchar_t *ClassID);
cxxlObject *cxxlFASTCALL New_CLightSpot();
cxxlPreserve2 *cxxlFASTCALL Regenera_CLightSpot(const wchar_t *ClassID);
cxxlObject *cxxlFASTCALL New_CLightSourceMgrRD();
cxxlPreserve2 *cxxlFASTCALL Regenera_CLightSourceMgrRD(const wchar_t *ClassID);

cxxlObject *cxxlFASTCALL New_CTextureRD_2D();
cxxlPreserve2 *cxxlFASTCALL Regenera_CTextureRD_2D(const wchar_t *ClassID);
cxxlObject *cxxlFASTCALL New_CMutiTextureRD();
cxxlPreserve2 *cxxlFASTCALL Regenera_CMutiTextureRD(const wchar_t *ClassID);
cxxlObject *cxxlFASTCALL New_CTextureRD_AttrBox();
cxxlPreserve2 *cxxlFASTCALL Regenera_CTextureRD_AttrBox(const wchar_t *ClassID);
cxxlObject *cxxlFASTCALL New_CCubemapTextureRD();
cxxlPreserve2 *cxxlFASTCALL Regenera_CCubemapTextureRD(const wchar_t *ClassID);


cxxlObject *cxxlFASTCALL New_CSolidRD();
cxxlPreserve2 *cxxlFASTCALL Regenera_CSolidRD(const wchar_t *ClassID);


extern "C" CXXL_DLLEXPORT
cxxlObject * cxxlCDECL CxxlMan_ObjectFactory(const wchar_t *ClassID, void *Arg, ISpirit *spirit)
{
  if(wcscmp(ITest_ClassID, ClassID) == 0)  
    return New_CTestRD();
  else if(wcscmp(ITextureRD_2D_ClassID, ClassID) == 0)
    return New_CTextureRD_2D();
  else if(wcscmp(ICubemapTextureRD_ClassID, ClassID) == 0)
    return New_CCubemapTextureRD();
  else if(wcscmp(IMutiTextureRD_ClassID, ClassID) == 0)
    return New_CMutiTextureRD();
  else if(wcscmp(ITextureRD_AttrBox_ClassID, ClassID) == 0)
    return New_CTextureRD_AttrBox();
  else if(wcscmp(IVertex_NC_ClassID, ClassID) == 0)
    return New_CVertexRD_NC();
  else if(wcscmp(IVertex_NT_ClassID, ClassID) == 0)
    return New_CVertexRD_NT();
  else if(wcscmp(IVertex_T_ClassID, ClassID) == 0)
    return New_CVertexRD_T();
  else if(wcscmp(IVertex_C_ClassID, ClassID) == 0)
    return New_CVertexRD_C();
  else if(wcscmp(IVertex_N_ClassID, ClassID) == 0)
    return New_CVertexRD_N();
  else if(wcscmp(ITrianglesStrip_ClassID, ClassID) == 0)
    return New_CTrianglesStripRD();
  else if(wcscmp(ITrianglesList_ClassID, ClassID) == 0)
    return New_CTrianglesListRD();
  else if(wcscmp(ILightAttrib_ClassID, ClassID) == 0)
    return New_CLightAttribRD();
  else if(wcscmp(IControlAttrib_ClassID, ClassID) == 0)
    return New_CControlAttribRD();
  else if(wcscmp(IGroup_ClassID, ClassID) == 0)
    return New_CGroupRD(Arg);
  else if(wcscmp(IAnchor_ClassID, ClassID) == 0)
    return New_CAnchorRD();
  else if(wcscmp(ILightAmbient_ClassID, ClassID) == 0)
    return New_CLightAmbient();
  else if(wcscmp(ILightDirectional_ClassID, ClassID) == 0)
    return New_CLightDirectional();
  else if(wcscmp(ILightPoint_ClassID, ClassID) == 0)
    return New_CLightPoint();
  else if(wcscmp(ILightSpot_ClassID, ClassID) == 0)
    return New_CLightSpot();
  else if(wcscmp(ILightSourceMgr_ClassID, ClassID) == 0)
    return New_CLightSourceMgrRD();
  else if(wcscmp(ISolid_ClassID, ClassID) == 0)
    return New_CSolidRD();

  return NULL;
}

extern "C" CXXL_DLLEXPORT
cxxlPreserve2 * cxxlCDECL CxxlMan_Preserve2Factory(const wchar_t *ClassID)
{
  cxxlPreserve2 *p;

  (  
      (p = Regenera_CTestRD(ClassID)) ||
      (p = Regenera_CTextureRD_2D(ClassID)) ||
      (p = Regenera_CCubemapTextureRD(ClassID)) ||
      (p = Regenera_CMutiTextureRD(ClassID)) ||
      (p = Regenera_CTextureRD_AttrBox(ClassID)) ||
      (p = Regenera_CVertexRD_NC(ClassID)) ||
      (p = Regenera_CVertexRD_NT(ClassID)) ||
      (p = Regenera_CVertexRD_T(ClassID)) ||
      (p = Regenera_CVertexRD_C(ClassID)) ||
      (p = Regenera_CVertexRD_N(ClassID)) ||
      (p = Regenera_CTrianglesStripRD(ClassID)) ||
      (p = Regenera_CTrianglesListRD(ClassID)) ||
      (p = Regenera_CLightAttribRD(ClassID)) ||
      (p = Regenera_CControlAttribRD(ClassID)) ||
      (p = Regenera_CGroupRD(ClassID)) ||
      (p = Regenera_CAnchorRD(ClassID)) ||
      (p = Regenera_CLightAmbient(ClassID)) ||
      (p = Regenera_CLightDirectional(ClassID)) ||
      (p = Regenera_CLightPoint(ClassID)) ||
      (p = Regenera_CLightSpot(ClassID)) ||
      (p = Regenera_CLightSourceMgrRD(ClassID)) ||
      (p = Regenera_CSolidRD(ClassID))
  );
  
  return p;
}
